//Class that takes the keyWordIndex and PageHistory and produces and XML document.
#ifndef XMLGEN_H
#define XMLGEN_H


#include <iostream>
#include <fstream>
#include <string>
#include "../utils/inc/StringUtil.h"
#include "LinkedList.h"
#include "Page.h"
#include "Occurrence.h"
#include "KeyWordIndex.h"
#include "PageHistory.h"

	using namespace std;

class XMLGenerator{

	private:
		void addFirstPage(Page* site);
		//Adds opening XML tags for document as well as appropriate tags for the root page
		void addPage(Page* site);
		//Adds XML tags and info(URL and description) for a page
		void addOccurrence(Occurrence* cur);
		//Adds XML tags and info(url,and count) for a specific occurance
		void addOccurrenceSet(string *key,OccurrenceSet* set);
		//Adds XML tage and info(word and vaule) for a word and calls addOccurance 
		//for every occurance in that set.
		void close();
		//Adds closing XML tags. closes file
		ofstream file;

	public:
		XMLGenerator();
		void generate(char* outputFile, PageHistory &history,KeyWordIndex &index);
		//Converts history and index into an XML document stored at the outputFile


}; 

#endif
